﻿@using X.PagedList;
@using X.PagedList.Mvc.Core;
@using X.PagedList.Mvc.Common;
@using FwProject.PrePaymentInfo.Dto
@model IPagedList<PaymentInfoDto>
@{
    Layout = null;
    int i = 0;
    if (Model.Count > 0)
    {
        if (Model.PageNumber != 1)
        {

            i = (Model.PageNumber - 1) * Model.PageSize;
        }
    }
    decimal Sumprice = 0;
}
<div id="table_print" style="max-height:600px;overflow-y:scroll;">

    <table class="table table-bordered table-hover table-rowselected">
        <thead>
            <tr>
                <th style="width:45px">序号</th>
                <th>日期</th>
                <th>凭证单号</th>
                <th>经办人</th>
                <th>缴款人</th>
                <th>收款详情</th>
                <th>合计</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count == 0)
            {
                <tr><td colspan="7" align="center">暂无数据</td></tr>
            }
            else
            {
                foreach (var item in Model)
                {
                    Sumprice += item.TotalPrice;
                    i++;
                    <tr>
                        <td>@i</td>
                        <td>@item.CreationTime.ToString("yyyy-MM-dd")</td>
                        <td>@item.PaymentNumber</td>
                        <td>@item.AgentPeoper</td>
                        <td>@item.PaymentPerson</td>
                        <td>
                            <dl>
                                @foreach (var d in item.ReceiptDetailsDto)
                                {
                                    @if (d.ToVoid == FwProject.PrePaymentInfo.ToVoidStatus.已作废)
                                    {
                                        <dt><s>@d.RestaurantName: ￥@d.TaskBackAmount [<a href="javascript:top.window.openTab(7451,'收款单[@d.ReceiptInfoNumber]','/Receipt/ReceiptDetail?id=@d.ReceiptInfoId')">@d.ReceiptInfoNumber</a>]</s><span style="color:red">（作废：@d.ToVoidTime.Value.ToString("yyyy-MM-dd")）</span></dt>

                                    }
                                    else
                                    {

                                        <dt>@d.RestaurantName: ￥@d.TaskBackAmount [<a href="javascript:top.window.openTab(7451,'收款单[@d.ReceiptInfoNumber]','/Receipt/ReceiptDetail?id=@d.ReceiptInfoId')">@d.ReceiptInfoNumber</a>]</dt>
                                    }

                                }

                            </dl>
                        </td>
                        <td>@item.TotalPrice</td>
                    </tr>
                }
                <tr class="footer">
                    <td>合计</td>
                    <td colspan="5"></td>
                    <td>@Sumprice</td>
                </tr>
            }
        </tbody>
    </table>
</div>
<div class="row pagedinfo">
    <div class="col-sm-5">
        @*共 @Model.TotalItemCount 条， @Model.PageSize 条/页 当前第 @Model.PageNumber/@Model.PageCount 页*@
        共 @Model.TotalItemCount 条，
        <select class="form-control" id="pageSize" style="width:70px;display:initial">
            @for (int z = 10; z < 100; z = z + 10)
            {
                if (z == Model.PageSize)
                {
                    <option selected value="@z">@z</option>
                }
                else
                {
                    <option value="@z">@z</option>
                }
            }
        </select> &nbsp;条/页 当前第 @Model.PageNumber/@Model.PageCount 页
    </div>
    <div class="col-sm-7">
        <input type="hidden" id="pageurl" value="&PaymentNumber=@(Context.Request.Query["PaymentNumber"])&AgentPeoperUserId=@(Context.Request.Query["AgentPeoperUserId"])&PaymentPerson=@(Context.Request.Query["PaymentPerson"])&beginTime=@(Context.Request.Query["beginTime"])&endTime=@(Context.Request.Query["endTime"])" />
        @Html.PagedListPager(Model, page => Url.Action("Index", new { pageIdx = page, size = Context.Request.Query["size"], PaymentNumber = Context.Request.Query["PaymentNumber"], AgentPeoperUserId = Context.Request.Query["AgentPeoperUserId"], PaymentPerson = Context.Request.Query["PaymentPerson"], beginTime = Context.Request.Query["beginTime"], endTime = Context.Request.Query["endTime"] }), PagedListRenderOptions.EnableUnobtrusiveAjaxReplacing(new AjaxOptions() { AllowCache = false, HttpMethod = "Get", UpdateTargetId = "data_list", OnSuccess = "AjaxSuccessCallback", OnBegin = "AjaxBegin" }))
    </div>
</div>

